package flight.training;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class Training {
	
	static public void training(String day, int cutoffhour, int cutoffminute)
	{
		Connection conn = null;
	    String url = "jdbc:mysql://localhost:3306/";
	    String dbName = "flight";
	    String driver = "com.mysql.jdbc.Driver";
	    String userName = "writeuser"; 
	    String password = "writeuser";
	    try {
	      Class.forName(driver).newInstance();
	      conn = DriverManager.getConnection(url+dbName,userName,password);
	      Statement st = conn.createStatement();
          ResultSet rs = st.executeQuery("select * from flighthistory where date(actual_runway_departure)<=\"2012-11-13\" and actual_runway_arrival>\"2012-11-13 14:24:00+00\" limit 100;");

          while (rs.next()) {
              System.out.println(rs.getString(1));
          }
	      
	      conn.close();
	    } catch (Exception e) {
	      e.printStackTrace();
	    }
	}

}
